package com.tedu.day02.test;

/**
 * Object 类    equals方法：比较两个对象是否相等
 * 两个china类，比较两个china类是否相等
 * 语法：引用1.equals（引用2）  引用1=引用2
 * equals
 */
class China{
    public String city;
    public String county;
    public boolean equals(Object o){
        China china=(China)o;

        boolean c=this.city.equals(china.city);
        boolean y=this.county.equals(china.county);
        return c;
    }
}

public class 对象对比 {
    public static void main(String[] args){
        China c1=new China();
        China c2=new China();
     //   System.out.println(c1.toString);
       // System.out.println(c2.toString);
        System.out.println(c1.equals(c2));
    }
}
